<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('节点监控列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>集群信息：</label>
                                <select name="clusterinfo" th:with="type=${@dict.getType('cluster_info')}">
                                    <option value="" selected>--请选择--</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>集群的节点IP：</label>
                                <input type="text" name="nodesIp"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('stats:nodes:edit')}]];
        var removeFlag = [[${@permission.hasPermi('stats:nodes:remove')}]];
        var clusterInfoDatas = [[${@dict.getType('cluster_info')}]];
        var prefix = ctx + "stats/nodes";

        $(function() {
            var options = {
                url: prefix + "/list",
                modalName: "节点监控",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'pkId', 
                    title: 'null',
                    visible: false
                },
                {
                    field: 'clusterInfo', 
                    title: '集群信息 60 45 86',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(clusterInfoDatas, value);
                    }
                },
                {
                    field: 'clusterName', 
                    title: '集群名称 lse1'
                },
                {
                    field: 'nodesTotal', 
                    title: '集群节点数'
                },
                {
                    field: 'nodesIp', 
                    title: '集群的节点IP'
                },
                {
                    field: 'nodesRoles', 
                    title: '集群的节点角色'
                },
                {
                    field: 'osCpuPercent', 
                    title: '节点CPU使用率'
                },
                {
                    field: 'osMemTotal', 
                    title: '节点Mem总量'
                },
                {
                    field: 'osMemFree', 
                    title: '节点Mem剩余量'
                },
                {
                    field: 'osMemUsed', 
                    title: '节点Mem使用量'
                },
                {
                    field: 'fsTotal', 
                    title: '节点FS磁盘总量'
                },
                {
                    field: 'fsFree', 
                    title: '节点FS磁盘剩余量'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.pkId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.pkId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>